package equals;

import java.util.Objects;

public class Main {
    public static void main(String[] args) {
        String s1 = "itheima";
        String s2 = "itheima";
        System.out.println(s1.equals(s2));//若s1为空值则会报错，留下隐患
        String s3 = null;
        System.out.println(Objects.equals(s2, s1));
        System.out.println(Objects.equals(s3,null));//更安全，更准确
        System.out.println(Objects.isNull(s3));
        System.out.println(Objects.isNull(s1));
    }
}
